import React from 'react'
import Son from './Son'
export default function Father() {
  const [count,setCount]  =React.useState(0)
  const [user,setUser]  =React.useState({name:'王五'})
  console.log('Father');
  function add(params) {
    setCount(s=>s+1)
  }
 const changeUser= React.useCallback((params)=>{
    console.log(params);
    setUser({name:params})
  })
//   function changeUser(params) {
//     setUser({name:params})
//   }
  return (
    <div>
        <h1>{count}   <button onClick={add}>+</button></h1>
      <Son  user={user}  callBack={changeUser}></Son>
    </div>
  )
}
